import * as axios from "axios";
import {constances} from "./index";

const changeDetail = (data) => ({
  type: constances.CHANGE_DETAIL,
  data
});

export const getDetail = (id) => {
  return (dispatch) => {
    axios.get('/api/detail.json?id='+ id).then(res => {
      const result = res.data;
      dispatch(changeDetail(result.data));
    }).then(err => {
      console.log(err);
    });
  }
};